home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Info / TeachU14 / SAMS / Code / Day01 / multiply.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-08  |  748 b   |  38 lines

  1. //---------------------------------------------------------------------------
  2. #include <condefs.h>
  3. #include <iostream.h>
  4. #include <conio.h>
  5. #pragma hdrstop
  6.  
  7. int multiply(int, int);
  8. void showResult(int);
  9.  
  10. //
  11. // We comment out the argc and argv variables to avoid
  12. // compiler warnings.
  13. //
  14. int main(int /*argc*/, char /***argv*/)
  15. {
  16.   int x, y, result;
  17.   cout << endl << "Enter the first value: ";
  18.   cin >> x;
  19.   cout << "Enter the second value: ";
  20.   cin >> y;
  21.   result = multiply(x, y);
  22.   showResult(result);
  23.   cout << endl << endl << "Press any key to continue...";
  24.   getch();
  25.   return 0;
  26. }
  27.  
  28. int multiply(int x, int y)
  29. {
  30.   return x * y;
  31. }
  32.  
  33. void showResult(int res)
  34. {
  35.   cout << "The result is: " << res << endl;
  36. }
  37.  
  38.